Cache git repo info in session to avoid repeated queries #70
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements caching of git repository information in the session database to reduce repeated git command executions.
What changed:
currentBranch,ownerRepo,isFork,originOwnerRepofetchAndCacheRepoInfo()function to fetch and cache repo info on first accesssessions:get-git-commandssessions:get-remote-pull-requestsessions:get-pr-remote-commitsWhy:
Previously, every call to these handlers would execute git commands to get branch and remote information. This PR caches this data in the session database after the first query, significantly reducing git command overhead.
Testing:
gitCacheHandlers.test.tswith 4 tests covering cache hit/miss scenariosgitHandlers.test.tsto work with the caching mechanismTests
Type of change